import http from "@/utils/http";

export const getUserMenu = (data) => {
  // return http.post('',data)
  let router;
  if (data == 1) {
    router = {
      code: 0,
      data: {
        role: 0,
        routes: [
          {
            id: 1,
            name: "/",
            path: "/",
            component: "Layout",
            redirect: "/home",
            hidden: false,
            meta: { title: "首页", icon: "home" },
            children: [
              {
                name: "home",
                path: "/home",
                meta: { title: "首页" },
                component: "home",
              },
            ],
          },
          {
            id: 2,
            name: "my",
            path: "/my",
            component: "Layout",
            redirect: "/my/center",
            hidden: false,
            meta: { title: "个人中心", icon: "my" },
            children: [
              {
                name: "myCenter",
                path: "/my/center",
                meta: { title: "个人信息" },
                component: "my/center",
              },
              {
                name: "myUpdate",
                path: "/my/update",
                meta: { title: "修改密码" },
                component: "my/update",
              },
            ],
          },
          {
            id: 3,
            name: "employee",
            path: "/employee",
            component: "Layout",
            redirect: "/employee/info",
            hidden: false,
            meta: { title: "员工管理", icon: "employee" },
            children: [
              {
                name: "employeeInfo",
                path: "/employee/info",
                meta: { title: "基本信息" },
                component: "employee/index",
              },
              {
                name: "commute",
                path: "/employee/commute",
                meta: { title: "考勤信息" },
                component: "employee/commute",
              },
              {
                name: "salary",
                path: "/employee/salary",
                meta: { title: "工资信息" },
                component: "employee/salary",
              },
              {
                name: "employeeTrain",
                path: "/employee/train",
                meta: { title: "培训信息" },
                component: "employee/train",
              },
            ],
          },
          {
            id: 4,
            name: "department",
            path: "/department",
            component: "Layout",
            redirect: "/department/info",
            hidden: false,
            meta: { title: "部门管理", icon: "department" },
            children: [
              {
                name: "departmentInfo",
                path: "/department/info",
                meta: { title: "部门信息" },
                component: "department/index",
              },
              {
                name: "departmentTrain",
                path: "/department/train",
                meta: { title: "部门培训" },
                component: "department/train",
              },
            ],
          },
          {
            id: 5,
            name: "matters",
            path: "/matters",
            component: "Layout",
            redirect: "/matters/leave",
            hidden: false,
            meta: { title: "事务管理", icon: "matters" },
            children: [
              {
                name: "leave",
                path: "/matters/leave",
                meta: { title: "请假信息" },
                component: "matters/leave",
              },
              {
                name: "workOvertime",
                path: "/matters/work",
                meta: { title: "加班信息" },
                component: "matters/workOvertime",
              },
            ],
          },
          {
            id: 6,
            name: "recruitment",
            path: "/recruitment",
            component: "Layout",
            redirect: "/recruitmentplan",
            hidden: false,
            meta: { title: "招聘信息", icon: "recruitment" },
            children: [
              {
                name: "recruitmentplan",
                path: "/recruitmentplan",
                meta: { title: "招聘信息" },
                component: "recruitmentplan/index",
              },
            ],
          },
        ],
      },
      msg: "ccccc",
    };
  } else {
    router = {
      code: 0,
      data: {
        role: 2,
        routes: [
          {
            id: 1,
            name: "/",
            path: "/",
            component: "Layout",
            redirect: "/home",
            hidden: false,
            meta: { title: "首页", icon: "home" },
            children: [
              {
                name: "home",
                path: "/home",
                meta: { title: "首页" },
                component: "user/home",
              },
            ],
          },
          {
            id: 2,
            name: "my",
            path: "/my",
            component: "Layout",
            redirect: "/my/center",
            hidden: false,
            meta: { title: "个人中心", icon: "my" },
            children: [
              {
                name: "myCenter",
                path: "/my/center",
                meta: { title: "个人信息" },
                component: "user/userCenter",
              },
              {
                name: "myUpdate",
                path: "/my/update",
                meta: { title: "修改密码" },
                component: "user/userUpdate",
              },
            ],
          },
          {
            id: 3,
            name: "matters",
            path: "/matters",
            component: "Layout",
            redirect: "/matters/leave",
            hidden: false,
            meta: { title: "事项管理", icon: "matters" },
            children: [
              {
                name: "leave",
                path: "/matters/leave",
                meta: { title: "请假申请" },
                component: "user/leave",
              },
              {
                name: "workOvertime",
                path: "/matters/work",
                meta: { title: "加班申请" },
                component: "user/workOvertime",
              },
            ],
          },
          {
            id: 4,
            name: "resources",
            path: "/resources",
            component: "Layout",
            redirect: "/resources/salary",
            hidden: false,
            meta: { title: "记录信息", icon: "resources" },
            children: [
              {
                name: "salary",
                path: "/resources/salary",
                meta: { title: "工资详情" },
                component: "user/salary",
              },
              {
                name: "train",
                path: "/resources/train",
                meta: { title: "培训信息" },
                component: "user/train",
              },
            ],
          },
          {
            id: 5,
            name: "recruitment",
            path: "/recruitment",
            component: "Layout",
            redirect: "/recruitmentplan",
            hidden: false,
            meta: { title: "招聘信息", icon: "recruitment" },
            children: [
              {
                name: "recruitmentplan",
                path: "/recruitmentplan",
                meta: { title: "招聘信息" },
                component: "user/recruitmentplan",
              },
            ],
          },
        ],
      },
      msg: "dddddd",
    };
  }

  return Promise.resolve(router);
};
